﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using System.Data.Linq;
using MethodWorx.CMS.Membership;

namespace MethodWorx.CMS.Linq
{
    [Table(Name="dbo.UserRole")]
    public class LinqUserRole
    {
       
        #region Proxy Property For User
        private EntityRef<LinqUser> proxyUser = new EntityRef<LinqUser>();

        [Column(IsPrimaryKey = true, UpdateCheck = UpdateCheck.Never)]
        public Guid UserId { get; set; }
        
        [Association(IsForeignKey=true, Name="User", OtherKey="Id", ThisKey="UserId", Storage="proxyUser")]
        public LinqUser ProxyUser
        {
          get { return this.proxyUser.Entity; }
          set { this.proxyUser.Entity = value; }
        }
        
        public User User
        {
          get { return this.ProxyUser; }
          set { this.ProxyUser = (LinqUser)value; }
        }
        #endregion
      
        
        #region Proxy Property For Role
        private EntityRef<LinqRole> proxyRole = new EntityRef<LinqRole>();

        [Column(IsPrimaryKey = true, UpdateCheck = UpdateCheck.Never)]
        public Guid RoleId { get; set; }
        
        [Association(IsForeignKey=true, Name="Role", OtherKey="Id", ThisKey="RoleId", Storage="proxyRole")]
        public LinqRole ProxyRole
        {
          get { return this.proxyRole.Entity; }
          set { this.proxyRole.Entity = value; }
        }
        
        public Role Role
        {
          get { return this.ProxyRole; }
          set { this.ProxyRole = (LinqRole)value; }
        }
        #endregion
      
    }
}
